package com.wanmait.employment.manageController;




import com.baomidou.mybatisplus.annotation.TableField;
import com.github.pagehelper.PageInfo;
import com.wanmait.employment.entity.Industry;
import com.wanmait.employment.entity.PositionType;
import com.wanmait.employment.service.PositionTypeService;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("manage/positionType")
public class PositionTypeController {

    @Resource
    private PositionTypeService positionService;

    @Resource PositionTypeService positionTypeService;

    @GetMapping("list")
    @ResponseBody
    public AjaxResult list(@RequestParam(required = false) Integer industryId, String title, Integer pageNum, Integer pageSize){
        PageInfo<PositionType> pageInfo=positionService.select(industryId,title,pageNum,pageSize);
        return AjaxResult.success("",pageInfo);
    }
    @PostMapping("update")
    public AjaxResult update(@RequestBody PositionType positionType){
        positionService.update(positionType);
        return AjaxResult.success();
    }
    @GetMapping("delete")
    public AjaxResult delete(Integer id){
        positionService.delete(id);
        return AjaxResult.success();
    }
    @GetMapping("getListByIndustryId")
    public AjaxResult getListByIndustryId(String id){
        List<PositionType> positionTypeList=positionTypeService.getListByIndustryId(Integer.parseInt(id));
        return AjaxResult.success().put("positionTypeList",positionTypeList);
    }
}
